home *** CD-ROM | disk | FTP | other *** search
- { TPBoard 4.2 Copyright (c) 1987,88 by Jon Schneider & Rick Petersen
- Portions Copyright (c) 1986,87 by Steve Fox and Les Archambault
-
- Last modified :: 7-18-88 11:54 am
- }
-
- {$R-} {Range checking off}
- {$B-} {Boolean complete evaluation off}
- {$S-} {Stack checking off}
- {$I+} {I/O checking on}
- {$N-} {No numeric coprocessor}
-
- Unit EditUsr1;
-
- Interface
-
- Uses
- TPCrt, Dos, Globals, TAccess, Core1,
- Core2, TPSTRING, MsgMisc;
-
-
- procedure edit_user(fn : FirstName; ln : LastName; credits : Word);
-
-
- {==========================================================================}
-
-
- Implementation
-
-
- procedure change_user_params_A(num : Integer; var temp_user_rec : user_list);
-
- var
- temp, i : Integer;
- Str : StrStd;
-
- begin
- with temp_user_rec do
- begin
- case num of
- 1 :
- begin
- Str := prompt('Computer ', len_ad, 'EL');
- if Str <> '' then
- ad := Str;
- end;
- 2 :
- begin
- Str := prompt('City ', len_cy, 'EL');
- if Str <> '' then
- cy := Str;
- end;
- 3 :
- begin
- Str := prompt('State (2 ltrs.) ', len_st, 'ESL');
- if Str <> '' then
- st := Str;
- end;
- 4 :
- begin
- Str := prompt('Phone number ', len_ph, 'EL');
- if Str <> '' then
- ph := Str;
- end;
- 5 :
- begin
- Str := prompt('Password ', len_pw, 'ESL');
- if Str <> '' then
- pw := Str;
- end;
- 6 :
- begin
- Str := prompt('Access Level ', 3, 'EL');
- if Str <> '' then
- begin
- temp := strint(Str);
- if (temp <= user_rec.access) or (not remote_copy) then
- access := temp
- end;
- end;
- 7 :
- begin
- Str := prompt('Time Limit (min.) ', 3, 'EL');
- if Str <> '' then
- limit := strint(Str);
- end;
- 8 :
- begin
- Str := prompt('Nulls ', 1, 'EL');
- if Str <> '' then
- nulls := strint(Str);
- end;
- 9 :
- begin
- Str := prompt('Case (U/L) ', 1, 'ESL');
- if Str <> '' then
- shift_lock := (Str = 'U');
- end;
- 10 :
- begin
- Str := prompt('Noisy (Y/N) ', 1, 'ESL');
- if Str <> '' then
- noisy := (Str = 'Y');
- end;
- 11 :
- begin
- Str := prompt('Conferences 1-7 [enter consecutive #s: 0=none] ', 7, 'ESL');
- if Str <> '' then
- begin
- clear_bit(conf_flags, 0); {don't use this bit}
- for i := 1 to 7 do
- if Pos(Chr(i+48), Str) > 0 then
- set_bit(conf_flags, i)
- else
- clear_bit(conf_flags, i);
- if Str = '0' then
- conf_flags := 0;
- end;
- end;
- 12 :
- begin
- Str := prompt('Width (columns) ', 2, 'ESL');
- if Str <> '' then
- columns := strint(Str);
- end;
- end; {case}
- end;
-
- end;
-
-
-
- procedure change_user_params_B(num : Integer; var temp_user_rec : user_list);
-
- var
- Str : StrStd;
-
- begin
- with temp_user_rec do
- begin
- case num of
- 13 :
- begin
- Str := prompt('Lines per screen ', 2, 'ESL');
- if Str <> '' then
- lines := strint(Str);
- end;
- 14 :
- begin
- Str := prompt('On Today ', 5, 'EL');
- if Str <> '' then
- time_today := strint(Str);
- end;
- 15 :
- begin
- Str := prompt('On Total ', 5, 'EL');
- if Str <> '' then
- time_total := strint(Str);
- end;
- 16 :
- begin
- Str := prompt('Last Hi Msg. ', 5, 'EL');
- if Str <> '' then
- lasthi := strint(Str);
- end;
- 17 :
- begin
- Str := prompt('Uploads ', 5, 'EL');
- if Str <> '' then
- upload := strint(Str);
- end;
- 18 :
- begin
- Str := prompt('Downloads ', 5, 'EL');
- if Str <> '' then
- download := strint(Str)
- end;
- 19 :
- if test_bit(Flags, 1) then
- clear_bit(Flags, 1)
- else
- set_bit(Flags, 1);
- 20 :
- if test_bit(Flags, 2) then
- clear_bit(Flags, 2)
- else
- set_bit(Flags, 2);
- 21 :
- if test_bit(Flags, 3) then
- clear_bit(Flags, 3)
- else
- set_bit(Flags, 3);
- 22 :
- if test_bit(Flags, 4) then
- clear_bit(Flags, 4)
- else
- set_bit(Flags, 4);
- 23 :
- if test_bit(Flags, 5) then
- clear_bit(Flags, 5)
- else
- set_bit(Flags, 5);
- 24 :
- repeat
- Str := Copy(prompt('Protocol ', 1, 'ES'), 1, 1);
- protocol := Str[1];
- until (protocol in ['X', 'C', 'Y', 'B', 'Z', 'G', 'Q', 'O']) or (not Online);
- 25 :
- begin
- Str := prompt('Upload/Download ratio [0 = unlimited] ', 3, 'EL');
- if Str <> '' then
- ratio := strint(Str)
- end;
- 26 :
- begin
- Str := prompt('Account Balance [in cents] ', 4, 'EL');
- if Str <> '' then
- acct_bal := strint(Str)
- end;
-
- end; {case}
- end;
- end;
-
-
-
- procedure edit_user(fn : FirstName; ln : LastName; credits : Word);
- { Display and edit user record }
-
- var
- This : SectPtr;
- this1 : AreaPtr;
- num : Integer;
- user_num : LongInt;
- ed_fn : FirstName;
- ed_ln : LastName;
- key : StrName;
- temp_user_rec : user_list;
- found : Boolean;
-
-
- procedure display_user;
-
- var
- disp_case,
- disp_nois : Str3;
- Str : StrTAD;
- i : Integer;
-
- begin
- with temp_user_rec do
- begin
- WriteLn(Com);
- WriteLn(Com);
- WriteLn(Com, ' Name : ', fn, ' ', ln);
- WriteLn(Com, '1 Computer : ', ad);
- WriteLn(Com, '2 City : ', cy);
- WriteLn(Com, '3 State : ', st);
- WriteLn(Com, '4 Phone : ', ph);
- WriteLn(Com, '5 Password : ', pw);
- WriteLn(Com, '6 Acc. level: ', access);
- WriteLn(Com, '7 Time Limit: ', limit);
- WriteLn(Com, '8 Nulls : ', nulls);
- if shift_lock then
- disp_case := 'ON'
- else
- disp_case := 'OFF';
- WriteLn(Com, '9 Shift lock: ', disp_case);
- if noisy then
- disp_nois := 'ON'
- else
- disp_nois := 'OFF';
- WriteLn(Com, '10 Bell : ', disp_nois);
- Write(Com, '11 Conferences: ');
- found := False;
- for i := 1 to 7 do
- begin
- if test_bit(conf_flags, i) then
- begin
- Write(Com, i, ' ');
- found := True;
- end;
- end;
- if not found then
- Write(Com, 'None');
- WriteLn(Com);
- Write(Com, '12 Columns : ', columns:6, ' ':15, '19 Allow downloads: ');
- if test_bit(Flags, 1) then
- WriteLn(Com, ' No')
- else
- WriteLn(Com, 'Yes');
- Write(Com, '13 Lines : ', lines:6, ' ':15, '20 Allow private msgs: ');
- if test_bit(Flags, 2) then
- WriteLn(Com, ' No')
- else
- WriteLn(Com, 'Yes');
- Str := intstr(laston[4], 2)+'/'+intstr(laston[3], 2)+'/'+intstr(laston[5], 2);
- Write(Com, ' Last on : ', Str, ' ':13, '21 Allow public msgs: ');
- if test_bit(Flags, 3) then
- WriteLn(Com, ' No')
- else
- WriteLn(Com, 'Yes');
- Write(Com, '14 On today : ', time_today:6, ' ':15, '22 Allow any msgs: ');
- if test_bit(Flags, 4) then
- WriteLn(Com, ' No')
- else
- WriteLn(Com, 'Yes');
- Write(Com, '15 On total : ', time_total:6, ' ':15, '23 Exempt User purge: ');
- if test_bit(Flags, 5) then
- WriteLn(Com, 'Yes')
- else
- WriteLn(Com, ' No');
- WriteLn(Com, '16 Last high : ', lasthi:6, ' ':15, '24 Default Protocol: ',
- protocol);
- WriteLn(Com, '17 Uploads : ', upload:6, ' ':15, '25 Up/Down Ratio allowed: ',
- ratio);
- WriteLn(Com, '18 Downloads : ', download:6, ' ':15, '26 Account balance: ',
- acct_bal);
- WriteLn(Com);
- end;
- end;
-
- begin { edit_user }
- OK := True;
- SetSect(HomName);
- if (fn <> '') or (ln <> '') then
- begin
- ed_fn := fn;
- ed_ln := ln;
- end
- else
- begin
- ed_fn := trim(prompt('First Name', len_fn, 'ESN'));
- if ed_fn = 'SYSOP' then
- ed_ln := ''
- else if ed_fn <> '' then
- ed_ln := trim(prompt('Last Name', len_ln, 'ESN'));
- end;
- if ((ed_fn = '') or (ed_ln = '')) and (ed_fn <> 'SYSOP') then
- OK := False;
- if OK then
- begin
- key := pad(ed_ln, len_ln)+pad(ed_fn, len_fn);
- SearchKey(IdxF, user_num, key);
- end;
- if OK then
- begin
- if user_num = user_loc then
- temp_user_rec := user_rec
- else
- GetRec(DatF, user_num, temp_user_rec);
- if ((temp_user_rec.access <= user_rec.access) or (not remote_copy))
- and (credits = 0) then
- { Only edit users <= self }
- begin
- repeat
- display_user;
- num := strint(prompt('Number to change..[ 0 to abort, 99 to record] ', 2, 'EL')
- );
- if (num <> 0) and (num <> 99) then
- begin
- if num = 11 then
- begin
- found := False;
- WriteLn(Com, 'Message Conferences:');
- this1 := AreaBase;
- while this1 <> nil do
- begin
- this1^.AreaConf := this1^.AreaConf and 7;
- if this1^.AreaConf > 0 then
- begin
- found := True;
- WriteLn(Com, ' ', this1^.AreaConf, ' ', this1^.AreaName
- , ' ', this1^.AreaDesc);
- end;
- this1 := this1^.next;
- end;
- if not found then
- WriteLn(Com, 'None.');
- WriteLn(Com);
- found := False;
- WriteLn(Com, 'File Conferences:');
- This := SectBase;
- while This <> nil do
- begin
- if This^.SectConf > 0 then
- begin
- found := True;
- WriteLn(Com, ' ', This^.SectConf, ' ', This^.SectName,
- ' ', This^.SectDesc);
- end;
- This := This^.next;
- end;
- if not found then
- WriteLn(Com, 'None.');
- WriteLn(Com);
- end;
- if num < 13 then
- change_user_params_A(num, temp_user_rec);
- if num > 12 then
- change_user_params_B(num, temp_user_rec);
- end;
- until (num = 0) or (num = 99);
- if num <> 0 then
- begin
- if user_num = user_loc then
- begin
- if not remote_copy then
- if ask('Record new permanent record', 'Y') then
- begin
- PutRec(DatF, user_num, temp_user_rec);
- WriteLn(Com, 'Recording updated user record.');
- end;
- user_rec := temp_user_rec;
- end
- else
- begin
- PutRec(DatF, user_num, temp_user_rec);
- WriteLn(Com, 'Recording updated user record.');
- end;
- end;
- end
- else if (credits > 0) and (user_num > 0) then
- begin
- temp_user_rec.upload := temp_user_rec.upload+credits;
- if user_num = user_loc then
- begin
- if not remote_copy then
- begin
- WriteLn(Com, 'Recording updated user record.');
- PutRec(DatF, user_num, temp_user_rec);
- end;
- user_rec := temp_user_rec;
- end
- else
- begin
- WriteLn(Com, 'Recording updated user record.');
- PutRec(DatF, user_num, temp_user_rec);
- end;
- end;
- end
- else
- WriteLn(Com, 'Name not found.')
- end;
-
- end. { of EDITUSR1.PAS}
-